package com.dream.base.thread;

/**
 * @author: WangKunHui
 * Date: 2017/8/18 14:09
 * Desc:
 * E-mail:life_artist@163.com
 */
public abstract class BaseTaskExecutor<T> implements IBaseTask<T> {

    private String tag;

    private boolean isCancel;

    public String getTag() {
        return tag;
    }

    public BaseTaskExecutor setTag(String tag) {
        this.tag = tag;
        return this;
    }

    public boolean isCancel() {
        return isCancel;
    }

    public BaseTaskExecutor cancel() {
        isCancel = true;
        return this;
    }

    public abstract T exec() throws Exception;

    @Override
    public void onMainPreExec() {

    }

    @Override
    public void onMainSuccess(T result) {

    }

    @Override
    public void onMainFailed() {

    }

}
